package com.smithcarlson.knucleotide
import java.io.FileReader
import java.io.Reader
import java.io.File
import scala.io.Source
import scala.collection.immutable.PagedSeq
import scala.collection.LinearSeq
import scala.collection.generic.GenericTraversableTemplate
import scala.collection.LinearSeqOptimized

object KNucleotide2 extends Application {
  override def main(args: Array[String]): Unit = {
    val startTimeMillis = System.currentTimeMillis()
    val lineStream: Stream[String] =
      Source.fromFile("knucleotide-input-small1.txt").getLines.toStream

    for (i <- lineStream) print(".");

    val endTimeMillis = System.currentTimeMillis()
    println()
    println(endTimeMillis - startTimeMillis)
  }
}

trait Enum[A] {
  trait Value { self: A => _values :+= this }
  private var _values = List.empty[A]
  def values = _values
}

object TNucleicAcid extends Enum[TNucleicAcid]
sealed trait TNucleicAcid extends TNucleicAcid.Value
case object A extends TNucleicAcid
case object C extends TNucleicAcid
case object G extends TNucleicAcid
case object T extends TNucleicAcid

class FastaStream(val label: String, val sequence: Stream[TNucleicAcid]) {

}

object FastaStream {
  def fromLines(lines: Stream[String]): Stream[FastaStream] = {
    null
  }
}

// (val label: String, val sequence: Stream[NucleicAcid]) {}

//object FilteredStreams {
//  def fromLines(lines: Stream[String]): Stream[String] = {
//    //    val headerPattern = "\\^(\\w+)".r
//    //    val commentPattern =
//    lines match {
//      case Stream.Empty => Stream.Empty
//      case l :: a if l.trim.startsWith(">") => Stream.Empty
//      case _ => Stream.cons(line, Stream.Empty)
//    }
//  }
//
//}

trait ReadaheadStream[+A] {
  def readahead: A
}

class LookaheadStream[+A](val delegateStream: Stream[A]) {
  def isEmpty: Boolean = delegateStream.isEmpty
  def head: A = delegateStream.head
  def tail: Stream[A] = delegateStream.tail
}